package com.ck.distributedLock.controller;

import com.ck.distributedLock.service.LockService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ck
 * @date 2023/7/5 9:21
 */
@RestController
@Slf4j
public class LockTestController {

    /**
     * 模拟多个用户同时请求同一个接口所产生的高并发的场景，会有共享资源的竞争(加锁解决) (jmeter)
     */
    @Autowired
    LockService lockService;

    @RequestMapping("lockTest")
    public String LockTest()  {
        lockService.updateCount5();
        return "success";
    }
}
